import Vue from "vue";
import App from "./App.vue";
//三级联动组件--全局组件
import TypeNav from "@/components/TypeNav/TypeNav.vue";
//轮播图全局组件
import Carousel from "@/components/Carousel/Carousel.vue";
//分页器全局组件
import Pagination from "@/components/Pagination/Pagination.vue";

import { Button, MessageBox, Alert } from "element-ui";

//第一个参数:全局组件的名字,第二个参数:哪一个组件
Vue.component("TypeNav", TypeNav);
Vue.component("Carousel", Carousel);
Vue.component("Pagination", Pagination);
//挂载到原型上
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
//注册全局组件
Vue.component(Button.name, Button);
//引入mockServe.js
import "@/mock/mockServe.js";

//引入swiper样式
import "swiper/css/swiper.css";

//统一接口api文件夹里面的全部请求
//统一引入
import * as API from "@/api";

//引入路由
import router from "@/router";

//引入仓库
import store from "@/store";

Vue.config.productionTip = false;

import atm from "@/assets/kun.gif";
import VueLazyload from "vue-lazyload";
Vue.use(VueLazyload, {
  loading: atm,
});
new Vue({
  render: (h) => h(App),
  //全局事件总线$bus配置
  beforeCreate() {
    Vue.prototype.$bus = this;
    Vue.prototype.$API = API;
  },
  //注册路由
  //注册路由信息:当这里书写router的时候,组件身上都拥有$router,$route属性
  router,
  //注册仓库:组件实例的身上会多一个$store属性
  store,
}).$mount("#app");
